package com.github.chxiaowu.common;

public class Pagination {
	private int pageNo = 1;
	private int pageSize = 10;
	private int pageCount = 0;
	private int total;

	public Pagination() {
		super();
	}

	public Pagination(int pageNo, int pageSize) {
		super();
		this.pageNo = pageNo;
		this.pageSize = pageSize;
	}

	public Pagination(int pageNo, int pageSize, int total) {
		super();
		this.pageNo = pageNo;
		this.pageSize = pageSize;
		this.total = total;
	}

	public int getPageNo() {
		return pageNo;
	}

	public void setPageNo(int pageNo) {
		this.pageNo = pageNo;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getTotal() {
		return total;
	}

	public void setTotal(int total) {
		this.total = total;
	}

	public int getPageCount() {
		return (total + pageSize - 1) / pageSize;
	}

	public void setPageCount(int pageCount) {
		this.pageCount = pageCount;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Pagination [pageNo=").append(pageNo).append(", pageSize=").append(pageSize)
				.append(", pageCount=").append(pageCount).append(", total=").append(total).append("]");
		return builder.toString();
	}

}
